//index.js
//获取应用实例
var app = getApp()

Page({
  data: {
    useData: "",
    goodsId:"",
    qz:"http://123.206.228.246:50080/wxone/"
  },
  tiaozhuan1:function(res){
    console.log(res)
    app.globalData.goodsId = res.currentTarget.dataset.id
    console.log(app.globalData.goodsId)
    wx.navigateTo({
      url: '../xiangqing/xiangqing?goodsId=' + res.currentTarget.dataset.item.goodsId,
    })
  },
  tiaozhuan2: function () {
    wx.navigateTo({
      url: '../new/new',
    })
  },
  
  /**
  * 生命周期函数--监听页面加载
  */
  onLoad: function (options) {
    wx.request({
      url: 'http://123.206.228.246:50080/wxone/goods/getGoodsByPage',
      method: 'POST',
      data: {
        page: 1,
        pageSize: 30,  //一页数据的个数
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: (res) => {
        console.log(res)
        this.setData({
          useData: res.data.data,
          goodsId: res.data.data[0].goodsId
        })
      }
    })
  },
  // 页面显示
  onShow:function(){
    var that = this;
    that.onLoad();
  }
})



  
 

